package com.siki.vo.enterprise;


import com.siki.pojo.commonEntity.TalentPosition;
import com.siki.pojo.enumeration.common.PositionCategory;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Getter;
import lombok.NoArgsConstructor;
import lombok.Setter;

import java.util.Optional;

@ApiModel("岗位列表返回VO")
@Getter
@Setter
@NoArgsConstructor
public class TalentPositionListInfoVO {
    @ApiModelProperty("id")
    Long id;

    @ApiModelProperty(value = "职位名称")
    private String positionName;

    @ApiModelProperty(value = "职位的类别")
    private String positionCategory;

    @ApiModelProperty(value = "是否发布")
    Boolean released;

    public TalentPositionListInfoVO(TalentPosition talentPositions){
        Optional.ofNullable(talentPositions).ifPresent(talentPosition -> {
            this.id=talentPosition.getId();
            this.positionName=talentPosition.getPositionName();
            this.positionCategory = Optional.ofNullable(talentPosition.getPositionCategory())
                    .map(PositionCategory::getName).orElse(null);
            this.released = talentPosition.getReleased();
        });
    }
}
